function Student(name, age) {
    this.name = name;
    this.age = age;

    this.study = function study() {
        console.log(this.name + " study..");
    }
}

let student = new Student("xiaoming", 18);
student.study();

// ES6之后
class Teacher {
    constructor(name) {
        this.name = name
    }

    hello() {
        console.log(this.name + " hello");
    }
}

let teacher = new Teacher("立老师");
teacher.hello();

class MathTeacher extends Teacher {
    constructor(grade) {
        super("数学老师");
        this.grade = grade;
    }

    hello() {
        console.log(this.grade + this.name + " hello");
    }
}

let mathTeacher = new MathTeacher("三年级");
mathTeacher.hello();